
#region using Statements

using System;
using System.Configuration;
using System.Web;

#endregion

public class LiveRPS
{

    #region CreateRedirectString

    public static string CreateRedirectString(string slt, string RedirectURL, string siteId)
    {
        const string LoginUrlFormat = "https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv=11&rver=5.5.4177.0&wp={0}&wreply={1}&id={2}&slt={3}";

        // Examples of RedirectURL are...
        //"https://outlook.com/edu" if Outlook Live
        //"http://mail.live.com/default.aspx" if Hotmail
        //"http://skydrive.live.com/home.aspx?provision=1";

        // Specify destination Auth Policy and URL
        // Get these from the destination service.
        string authPolicy = "MBI";
        if (RedirectURL.ToLower().StartsWith("https"))
        {
            authPolicy = "MBI_SSL";
        }

        string url = String.Format(LoginUrlFormat, authPolicy, RedirectURL, siteId, slt);
        return url;
    }
    #endregion

}

